<div id="addExpress">
    <form @submit.prevent="add">
        <div class="form-group">
            <label>invoice</label>
            <input type="text" class="form-control" v-model="invoice" required/>
        </div>
        <div class="form-group">
            <label>运费</label>
            <input type="number" class="form-control" v-model="fee" required/>
        </div>
        <button class="btn btn-success">添加</button>
    </form>
</div>
<script>
    new Vue({
        el: "#addExpress",
        data: {
            invoice: '',
            fee: '',
            id:<?php echo $this->params['id'];?>
        },
        methods: {
            add: function () {
                $.post('/table/express-split', {id: this.id, invoice: this.invoice, fee: this.fee}, function (res) {
                    if (res.code == 1) {
                        layer.alert(res.msg);
                        setTimeout(function () {
                            window.location.reload();
                        }, 1000)
                    } else {
                        layer.alert(res.msg);
                    }
                }, 'json')
            }
        }
    })
</script>